<template>
  <div class="main">
    <div class="left-main">
      <nav-bar>
        <nav-logo slot="logo" />
        <nav-item
          slot="item"
          v-for="(item, idx) in NavBarItems"
          :itemInfo="item"
          :idx="idx"
          :key="item.name"
          @nvaClick="navName"
        />
      </nav-bar>
    </div>

    <div style="width:64px;height:100%"></div>
    
    <div class="right-main">
      <div class="head">
        <div class="title">{{ title }}</div>
        <div class="head-account">
        <account style="float: right"></account>
        </div>
        <router-link to="/main/shezhi/qj-xxtz">
          <div class="msg">
            <img src="@/assets/u100.svg" alt="">
            <img src="@/assets/u101.svg" alt="">
          </div>          
        </router-link>

      </div>
      <div class="context">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
import Account from "@/components/Account/Account";
import NavBar from "@/components/NavBar/NavBar";
import NavItem from "@/components/NavBar/NavItem";
import NavLogo from "@/components/NavBar/NavLogo";

export default {
  computed: mapState(["NavBarItems","title"]),
  components: {
    Account,
    NavBar,
    NavItem,
    NavLogo,
  },
  created() {},
  data: function () {
    return {
      // title: "首页",
    };
  },
  methods: {
    navName(data) {
      console.log(data);
      var _ = data;
      if (data === "历史") _ = "历史会话";
      if (data === "统计") _ = "数据总览";
      this.$store.commit('setTitle',_)
    },
  },
};
</script>

<style scoped>
.main {
  width: 100%;
  height: 100%;
  display: flex;
}

.left-main{
  height: 100%;
  position: fixed;
  z-index: 2;
}

.right-main{
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column;
}

.head {
  height: 64px;
  line-height: 64px;
  width: calc(100vw - 64px);
  font-size: 0.8em;
  background-color: white;
  position: fixed;
  z-index: 1;
}

.title {
  padding: 0 20px;
  float: left;
  color: black;
  font-size: 1.5em;
}

.head-account{
  margin-right: 20px;
  margin-top: 5px;
}

.msg {
  float: right;
  margin-right: 15px;
}

.msg img:nth-of-type(2){
  position: relative;
  top: -13px;
  left: -5px;
}

.context {
  padding: 15px;
  display: flex;
  height: 100%;
  margin-top: 64px;
}
</style>
